package com.example.a313ldy.yuejian_17.Fragment.IndexFragment.MasterFragment;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.a313ldy.yuejian_17.Adapter.MasterAdapter;
import com.example.a313ldy.yuejian_17.Bean.Master;
import com.example.a313ldy.yuejian_17.Listener.MasterListener;
import com.example.a313ldy.yuejian_17.Model.MasterModel;
import com.example.a313ldy.yuejian_17.R;

import java.util.List;

/**
 * Created by LDY on 2017/10/9.
 */

public class MasterFragment extends Fragment implements MasterListener<Master> {


    RecyclerView recyclerView_Masterlist;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View  v = inflater.inflate(R.layout.fragment_master,null);
        recyclerView_Masterlist = (RecyclerView) v.findViewById(R.id.id_fragment_main);
        recyclerView_Masterlist.setLayoutManager(new LinearLayoutManager(getActivity()));


        MasterModel MasterModel = new MasterModel();
        MasterModel.MasterData(this);
        return v;
    }




    @Override
    public void onResponse(Master Master) {
        List<Master.ClubcoachlistEntity> ClubcoachlistEntity = Master.getClubcoachlist();
        System.out.println("+++++" + ClubcoachlistEntity);
        MasterAdapter adapter = new MasterAdapter(getActivity(), ClubcoachlistEntity);
        recyclerView_Masterlist.setAdapter(adapter);
    }

    @Override
    public void onFail(String msg) {
        System.out.println("+++++" + "失败率");
    }



}
